#include "my_sdk.h"
#include "HCNetSDK.h"
My_SDK::My_SDK()
{
     NET_DVR_Init();
     NET_DVR_SetConnectTime(2000, 1);
     NET_DVR_SetReconnect(10000, true);
}
bool My_SDK::online(QString &ip)
{
    NET_DVR_DEVICEINFO_V30 struDeviceInfo;
    this->devIp =ip;
   // qDebug() << ip;
    lUserID = NET_DVR_Login_V30(this->devIp.toLocal8Bit().data(),8000,"admin", "12345", &struDeviceInfo);
//    if (lUserID < 0)
//    {
//        qDebug()<< "Login error:" << NET_DVR_GetLastError();
//         NET_DVR_Logout(this->lUserID);
//        return false;
//    }
//    else
//    {
//       qDebug() << "login ok";
//    }

    NET_DVR_Logout(this->lUserID);
    if(lUserID<0)
        return false;
    else
        return  true;
}
/*void sendOneCardSnCallBack( DWORD    dwType,  void     *lpBuffer,  DWORD    dwBufLen,  void     *pUserData)
{
    NET_DVR_CARD_CFG *cardInfo = (NET_DVR_CARD_CFG *)lpBuffer;
    qDebug() << "send OneCard back";
    qDebug() << "type:" << dwType;
    qDebug() << "dwBufLen:" << dwBufLen;
    qDebug() << cardInfo->byCardNo;
    qDebug() << *(QString *)pUserData;
}
LONG My_SDK::startRemote(LONG count)
{
    NET_DVR_CARD_CFG_COND cardCfg;
    cardCfg.dwSize = sizeof(cardCfg);
    cardCfg.dwCardNum =  count;
    cardCfg.byCheckCardNo = 0;
    //this->lHandle=NET_DVR_StartRemoteConfig(this->lUserID,NET_DVR_SET_CARD_CFG,&cardCfg,sizeof(cardCfg),sendOneCardSnCallBack,NULL);
    if(this->lHandle < 0)
    {
        qDebug() <<   "NET_DVR_GET_CARD_CFG error:" << NET_DVR_GetLastError();
         return -1;
    }
    return this->lHandle;
}*/
My_SDK::~My_SDK()
{
}
